package com.tarena.lbs.user.controller;

import com.tarena.lbs.base.protocol.model.Result;
import com.tarena.lbs.user.service.CaptchaService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import java.io.IOException;

@Slf4j
@RestController
@Tag(name = "验证码接口")
@RequestMapping("/v1/captcha")
public class CaptchaController {

    @Autowired
    private CaptchaService captchaService;
    @Operation(summary = "生成验证码图片")
    @GetMapping(value = "/generate")
    public Result<String> generateCaptcha() throws IOException {
        String code=captchaService.generateCode();
        return new Result<>(code);
    }


}